/*****************************************************************************************
 * SVN­Version­Information:
 * ­­­­­­­­­­­­­­­­­­­­­­­­---------------------
 * $LastChangedRevision: 6 $
 * $LastChangedBy: c.a.duevel $
 * $LastChangedDate: 2009-08-26 15:12:37 +0000 (Wed, 26 Aug 2009) $
 * $HeadURL: http://robofight.googlecode.com/svn/trunk/ClientJava/src/de/hft_stuttgart/robofight/client/java/JRobot.java $
 *****************************************************************************************/
package de.hft_stuttgart.robofight.client.java;

import de.hft_stuttgart.botwar.common.models.Position;

/**
 *
 * @author ralf.dauenhauer@gmx.de, michael.rieker@web.de
 */
public class JRobot {

    private Position pos;
    private boolean isShooting = false;
    private Integer targetRobot;
    private Integer color;
    private Integer actualHealth;
    private Integer id;
    private String chassisName;
    private String shieldName;
    private String weaponName;
    private Double healthPercentage;
    /**
     * Init a JRobot.
     * @param pos the current position of the bot
     * @param color the color of the bot
     * @param id the id of the bot
     * @param health the health of the bot
     * @param chassisName the name of the chassis
     * @param shieldName the name of the shield
     * @param weaponName the name of the weapon
     */
    public JRobot(final Position pos, final Integer color, final Integer id,
            final Integer health, final String chassisName,
            final String shieldName, final String weaponName) {

        this.pos = pos;
        this.color = color;
        this.id = id;
        this.actualHealth = health;
        this.chassisName = chassisName;
        this.shieldName = shieldName;
        this.weaponName = weaponName;
        healthPercentage = (double) 100 / actualHealth;
    }

    /**
     * returns chassis Name.
     * @return chassisName the name of the chassis
     */
    public final String getChassisName() {
        return chassisName;
    }

    /**
     * returns ShieldName.
     * @return shieldName the name of the shield
     */
    public final String getShieldName() {
        return shieldName;
    }

    /**
     * returns WeaponName.
     * @return weaponName the name of the weapon
     */
    public final String getWeaponName() {
        return weaponName;
    }

    /**
     * Returns true, if a bot is shooting.
     * @return isShooting boolean if a bot is shooting
     */
    public final boolean isShooting() {
        return isShooting;
    }

    /**
     * Returns the id of a bot.
     * @return id id of the bot
     */
    public final Integer getId() {
        return id;
    }

    /**
     * sets a bot to shoot.
     * @param isShooting sets boolean if a bot is shooting or not
     */
    public final void setIsShooting(final boolean isShooting) {
        this.isShooting = isShooting;
    }

    /**
     * sets new health value.
     * @param actualHealth sets the current health
     */
    public final void setHealth(final Integer actualHealth) {
        this.actualHealth = actualHealth;
    }

    /**
     * returns health value.
     * @return health the health of the bot
     */
    public final Double getHealth() {
        return (healthPercentage * actualHealth);
    }

    /**
     * sets a target for a shoot.
     * @param targetRobot sets the target bot as shoot target
     */
    public final void setShootTo(final Integer targetRobot) {
        setIsShooting(true);
        this.targetRobot = targetRobot;
    }

    /**
     * Returns the target of the attacked bot.
     * @return targetRobot target of the attacked bot
     */
    public final Integer getTargetRobot() {
        return this.targetRobot;
    }

    /**
     * returns the current position.
     * @return pos current position
     */
    public final Position getPos() {
        return pos;
    }

    /**
     * sets a new position.
     * @param newPos needs the new position to set this position
     */
    public final void setNewPos(final Position newPos) {
        this.pos = newPos;
    }

    /**
     * Returns the color of a bot in int.
     * @return color color of the bot
     */
    public final Integer getColor() {
        return this.color;
    }
}


